package cn.tedu.shoppingmall.vo;

import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
@Data
@Accessors(chain = true)
public class User {

    private Integer id;
    @NotNull(message = "用户名不能为空")
    @Pattern(regexp = "^\\w{1,20}$",message = "用户名必须是1~20个字符(字母,数字,_,$)")
    private String username;
    @NotNull(message = "密码不能为空")
    @Pattern(regexp = "^\\w{5,20}$",message = "密码必须是5~20个字符")
    private String password;
    @NotNull(message = "确认密码不能为空")
    private String confirm;             // 确认密码
    @NotNull(message = "昵称不能为空")
    @Pattern(regexp = "^.{2,20}$",message = "昵称是2~20个字符")
    private String nick;
    @NotNull(message = "手机号不能为空")
    @Pattern(regexp = "^^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$",message = "请输入正确手机号")
    private String phone;
//暂时不用这个,用用户细节表存
    private String age;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", confirm='" + confirm + '\'' +
                ", nick='" + nick + '\'' +
                ", phone='" + phone + '\'' +
                ", age=" + age +
                '}';
    }

    public String getConfirm() {
        return confirm;
    }

    public void setConfirm(String confirm) {
        this.confirm = confirm;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }
}
